<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="Content-Style-Type" content="text/css">
        <script type="text/javascript">
            var ws = new WebSocket("ws://localhost:9999 ");
          
            ws.onopen = function() {};  
            ws.onmessage = function (e) {
                alert(e.data)
            };  
            window.onbeforeunload = function() {
                ws.send("DISCONNECTED");
                ws.onclose = function () {}; // disable onclose handler first
                ws.close()
            };          
        </script>
        <style media="screen" type="text/css">
          body {vertical-align:middle;}
        </style>
    </head>
    <body align="center">
        <input id="msg" type="text" value="Hello World!"/>
        <button onclick="ws.send(document.getElementById('msg').value);">exec</button>
    </body>
</html>
